import { LOGIN } from './actionTypes'
const defaultState = {
    name: localStorage.getItem('name')
}

export default (state = defaultState, action) => {
    if (action.type === LOGIN) {
        let newState = JSON.parse(JSON.stringify(state));
        newState.name = action.name;
        localStorage.setItem('name', action.name);
        return newState;
    }
    return state;
}